-
-
Notifications
You must be signed in to change notification settings - Fork 836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: implement methods for structs #4041
base: master
Are you sure you want to change the base?
wip: implement methods for structs #4041
Conversation
from vyper.codegen.core import _freshname, eval_once_check, make_setter | ||
from vyper.codegen.ir_node import IRnode | ||
from vyper.evm.address_space import MEMORY | ||
from vyper.exceptions import StateAccessViolation | ||
from vyper.semantics.types.function import MemberFunctionT |
Check notice
Code scanning / CodeQL
Cyclic import Note
vyper.semantics.types.function
test contract: ``` struct Foo: user: address balance: uint256 def decrement_balance(self, amount: uint256): self.balance -= amount @external def foo(f: Foo): s: Foo = f s.decrement_balance(1) ```
e153e25
to
d94f548
Compare
A few examples of the intended use might be nice to see for commenting on the implementation |
check commit message - d94f548 |
@external
def foo(f: Foo):
s: Foo = f
s.decrement_balance(1)
|
i thought about it, i think additional syntax is overkill. it depends more just on the location of the item, like if you can do |
so you would be able to call a non-mutable method on |
@@ -21,6 +21,7 @@ | |||
) | |||
from vyper.semantics.data_locations import DataLocation | |||
from vyper.semantics.types.base import VyperType | |||
from vyper.semantics.types.function import MemberFunctionT |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
vyper.semantics.types.function
vyper.semantics.types.user
definition
import
'MemberFunctionT' may not be defined if module
What I did
just messing around, opening the PR so others can follow progress
How I did it
How to verify it
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Cute Animal Picture